<?php
class AdminController extends AppController {

    public $helpers = array('Html', 'Form');
    
	var $components = array('Auth');
	
	function beforeFilter()
	{
		$this->Auth->userModel = 'User';
		$this->Auth->fields = array('username' => 'username', 'password' => 'password');
		$this->Auth->loginAction = array('admin' => false, 'controller' => 'pages', 'action' => 'display');
		$this->Auth->loginRedirect = array('controller' => 'productos', 'action' => 'index');
	}
	
    public function admin_index() {
		
        $productos= ClassRegistry::init('Producto');
        $rubros= ClassRegistry::init('Rubro');
        $lineas= ClassRegistry::init('Linea');
        
        $info['productos']= $productos->find('count');
        $info['rubros']= $rubros->find('count');
        $info['lineas']= $lineas->find('count');
        
		$this->set('info', $info);
    }
}
?>